package com.zbhk.qc.controller;

import com.zbhk.qc.service.UserServer;
import com.zbhk.qc.dto.LoginInput;
import com.zbhk.qc.dto.LoginOutput;
import com.zbhk.qc.dto.BaseResponseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;


@Api(tags = "账号")
@RequestMapping(value = "/account")
@RestController("AccountController")
@RequiredArgsConstructor
public class AccountController {


    @Autowired
    private UserServer userServer;


    @ApiOperation(value = "登入", notes = "", produces = "application/json")
    @PostMapping("login")
    public BaseResponseEntity<LoginOutput> register(
            @Valid @ModelAttribute LoginInput loginInput, HttpServletRequest request) {
        return userServer.start(loginInput,request);
    }


}
